package com.tmpt.others.db;

import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

/**
 * Created by wxy on 2016/12/4.
 */
public class DynamicDataSource extends AbstractRoutingDataSource {

    @Override
    protected Object determineCurrentLookupKey() {
        //return dataSourceKey.get();
        //.out.println("=========determineCurrentLookupKey===" + DynamicDataSourceHolder.getDataSource());
        //DynamicDataSourceHolder.setDataSource("dataSourceB"); //有效
        return DynamicDataSourceHolder.getDataSource();
    }


}